UBYTE version[] ="$VER: IDEID 1.0 (01.04.99) (C) by OR\r\n";
LONG IDEID(VOID)
{
LONG rc=ERROR_NOT_IMPLEMENTED;
UBYTE *buffer1,*buffer2;
ULONG i;
if (DOSBase = (struct DosLibrary *)OpenLibrary("dos.library",39))
{
if (rdargs = ReadArgs("UNIT/A/N",&myarray[0],NULL))
{
if (!CheckSignal(SIGBREAKF_CTRL_C))
{
if (iddata = AllocVec(sizeof(struct IDData),MEMF_PUBLIC))
{
if (devport = CreateMsgPort())
{
if (devreq = CreateIORequest(devport,sizeof(struct IOStdReq)))
{
if (!OpenDevice("scsi.device",*(LONG *)myarray[ARG_UNIT],(struct IORequest *)devreq,NULL))
{
buffer1 = (UBYTE *)devreq->io_Unit + 0x66; // safe to read
buffer2 = (UBYTE *)iddata;
for (i=0; i < sizeof(struct IDData); i+=2) {*buffer2++ = *(buffer1+i+1);
*buffer2++ = *(buffer1+i);
}
PutStr( "Model number = "); WriteChars(iddata->id_Model,sizeof(iddata->id_Model));
PutStr("\nRevision number = "); WriteChars(iddata->id_Revision,sizeof(iddata->id_Revision));
PutStr("\nSerial number = "); WriteChars(iddata->id_Serial,sizeof(iddata->id_Serial));
PutStr("\n");
if (iddata->id_Config & 0x8000) PutStr("Non magnetic media\n");
else PutStr("Magnetic media\n");
if (iddata->id_Config & 0x4000) PutStr("Format speed tolerance gap required\n");
else PutStr("Format speed tolerance gap not required\n");
if (iddata->id_Config & 0x2000) PutStr("Track offset option available\n");
else PutStr("Track offset option not available\n");
if (iddata->id_Config & 0x1000) PutStr("Data strobe offset option available\n");
else PutStr("Data strobe offset option not available\n");
if (iddata->id_Config & 0x0800) PutStr("Rotational speed tolerance is > 0.5%\n");
else PutStr("Rotational speed tolerance is not > 0.5%\n");
if (iddata->id_Config & 0x0400) PutStr("Disk transfer rate > 10 Mbs\n");
if (iddata->id_Config & 0x0200) PutStr("Disk transfer rate > 5 Mbs but <= 10 Mbs\n");
if (iddata->id_Config & 0x0100) PutStr("Disk transfer rate <= 5 Mbs\n");
if (iddata->id_Config & 0x0080) PutStr("Removable drive\n");
if (iddata->id_Config & 0x0040) PutStr("Fixed drive\n");
if (iddata->id_Config & 0x0020) PutStr("Spindle motor control option implemented\n");
else PutStr("Spindle motor control option not implemented\n");
if (iddata->id_Config & 0x0010) PutStr("Head switch time > 15 usec\n");
else PutStr("Head switch time not > 15 usec\n");
if (iddata->id_Config & 0x0008) PutStr("Not MFM encoded\n");
else PutStr("MFM encoded\n");
if (iddata->id_Config & 0x0004) PutStr("Soft sectored\n");
if (iddata->id_Config & 0x0002) PutStr("Hard sectored\n");
if (iddata->id_Doubleword) PutStr("Can perform doubleword I/O\n");
else PutStr("Cannot perform doubleword I/O\n");
if (iddata->id_BufferType == 0x0000) PutStr("Buffer type not specified\n");
if (iddata->id_BufferType == 0x0001) PutStr("single ported single sector buffer which is not capable of simultaneous data transfers to or from the host and the disk\n");
if (iddata->id_BufferType == 0x0002) PutStr("Dual ported multi-sector buffer capable of simultaneous data transfers to or from the host and the disk\n");
if (iddata->id_BufferType == 0x0003) PutStr("Dual ported multi-sector buffer capable of simultaneous transfers with a read caching capability\n");
i = iddata->id_BufferSize*512; VPrintf("Buffer size = %lu\n",&i);
i = iddata->id_ECC; VPrintf("Number of ECC bytes passed on Read/Write long cmds = %lu\n",&i);
i = iddata->id_Mul & 0x00FF; VPrintf("Maximum number of sectors that can be transferred per interrupt on Read and Write Multiple commands = %lu\n",&i);
i = iddata->id_TrackSize; VPrintf("Unformatted track size = %lu\n",&i);
i = iddata->id_SectorSize; VPrintf("Unformatted sector size = %lu\n",&i);
if (iddata->id_Fields & 0x0001) PutStr("The fields reported in translation mode are valid\n");
else PutStr("The fields reported in translation mode may be valid\n");
PutStr("Default capacity (cylinders,heads,sectors per track) =");
i = iddata->id_Cyls; VPrintf(" %lu",&i);
i = iddata->id_Heads; VPrintf(" %lu",&i);
i = iddata->id_SectorsPerTrack; VPrintf(" %lu\n",&i);
PutStr("Translation mode (cylinders,heads,sectors per track,total sectors) =");
i = iddata->id_CurrentCyls; VPrintf(" %lu",&i);
i = iddata->id_CurrentHeads; VPrintf(" %lu",&i);
i = iddata->id_CurrentSectorsPerTrack; VPrintf(" %lu",&i);
i = iddata->id_CurrentSectors; i = (i<<16) | (i>>16); VPrintf(" %lu\n",&i);
if (iddata->id_Capabilities & 0x0100) PutStr("DMA supported\n");
else PutStr("DMA not supported\n");
i = iddata->id_PIO >> 8; VPrintf("PIO data transfer cycle timing mode = %lu\n",&i);
i = iddata->id_DMA >> 8; VPrintf("DMA data transfer cycle timing mode = %lu\n",&i);